/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Entidades;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author ivana
 */
@Entity
@Table(name = "estadooperario")
@NamedQueries({
    @NamedQuery(name = "Estadooperario.findAll", query = "SELECT e FROM Estadooperario e"),
    @NamedQuery(name = "Estadooperario.findByIdestadooperario", query = "SELECT e FROM Estadooperario e WHERE e.idestadooperario = :idestadooperario"),
    @NamedQuery(name = "Estadooperario.findByNombre", query = "SELECT e FROM Estadooperario e WHERE e.nombre = :nombre")})
public class Estadooperario implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "idestadooperario")
    private Integer idestadooperario;
    @Basic(optional = false)
    @Column(name = "nombre")
    private String nombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "estadooperario")
    private Collection<Operario> operarioCollection;

    public Estadooperario() {
    }

    public Estadooperario(Integer idestadooperario) {
        this.idestadooperario = idestadooperario;
    }

    public Estadooperario(Integer idestadooperario, String nombre) {
        this.idestadooperario = idestadooperario;
        this.nombre = nombre;
    }

    public Integer getIdestadooperario() {
        return idestadooperario;
    }

    public void setIdestadooperario(Integer idestadooperario) {
        this.idestadooperario = idestadooperario;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public Collection<Operario> getOperarioCollection() {
        return operarioCollection;
    }

    public void setOperarioCollection(Collection<Operario> operarioCollection) {
        this.operarioCollection = operarioCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idestadooperario != null ? idestadooperario.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Estadooperario)) {
            return false;
        }
        Estadooperario other = (Estadooperario) object;
        if ((this.idestadooperario == null && other.idestadooperario != null) || (this.idestadooperario != null && !this.idestadooperario.equals(other.idestadooperario))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Entidades.Estadooperario[idestadooperario=" + idestadooperario + "]";
    }

}
